package org.example.ecommerce_system.mapper;

import org.apache.ibatis.annotations.*;
import org.example.ecommerce_system.entity.User;

import java.util.List;

@Mapper
public interface UserMapper {

    @Select("select * from user where userName=#{userName} and userPWD=#{userPWD}")
    User login(User user);

    @Select("select * from user")
    List<User> getAllUser();

    @Select("select * from user where  userName like concat('%',#{userName},'%')")
    List<User> searchUser(String userName);

    @Delete("delete from user where userID=#{userID}")
    int deleteUser(int userID);

    @Insert("insert into user values (null,#{userName},#{userPWD})")
    int insertUser(User user);

    @Update("update user set userName=#{userName},uesrPWD=#{userPWD} where userID=#{userID}")
    int updateUser(User user);
}
